// pages/component/slider/slider.js
Component({
   properties: {

      vheight: {
         type: Number,
         value: 130
      },
      bsize: {
         type: Number,
         value: 20
      },
      show: {
         type: Number,
         value: 0
      },
      isVal:{
         type:Boolean,
         value:false
      }

   },
  
   data: {
      val_: 0,
      show: 0,
      slheight: 0,
      isVal:false
   },

   attached: function() {
      const scle = this.properties.vheight / 100
      let sheight = parseInt(this.properties.bsize) + parseInt(this.properties.vheight)
      this.setData({
         slheight: sheight,
         show: this.properties.show
      })
   },

   observers: {
      "show": function(show) {
         const scle = this.properties.vheight / 100
         this.setData({
            val_: show * scle
         })
      }
   },

   methods: {
      mmove(e) {
         const pra = this.properties.vheight;
         let show = Math.floor(e.detail.y / pra * 100)
         
         this.setData({
            show: show >98?100:show,
            val_: e.detail.y
         })

      }
   }

})